package com.ruoyi.project.module.ossConfigLog.service;

import java.util.Date;
import java.util.List;

import com.ruoyi.common.utils.security.ShiroUtils;
import com.ruoyi.project.module.task.mapper.TaskUtilsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.module.ossConfigLog.mapper.OssConfigLogMapper;
import com.ruoyi.project.module.ossConfigLog.domain.OssConfigLog;
import com.ruoyi.project.module.ossConfigLog.service.IOssConfigLogService;
import com.ruoyi.common.support.Convert;
import javax.annotation.Resource;

/**
 * 阿里云OSS资源更新日志 服务层实现
 * 
 * @author ruoyi
 * @date 2019-04-08
 */
@Service
public class OssConfigLogServiceImpl implements IOssConfigLogService 
{
	@Resource
	private OssConfigLogMapper ossConfigLogMapper;

	@Resource
	TaskUtilsMapper taskUtilsMapper;

	/**
     * 查询阿里云OSS资源更新日志信息
     * 
     * @param ossConfigLogId 阿里云OSS资源更新日志ID
     * @return 阿里云OSS资源更新日志信息
     */
    @Override
	public OssConfigLog selectOssConfigLogById(Integer ossConfigLogId)
	{
	    return ossConfigLogMapper.selectOssConfigLogById(ossConfigLogId);
	}
	
	/**
     * 查询阿里云OSS资源更新日志列表
     * 
     * @param ossConfigLog 阿里云OSS资源更新日志信息
     * @return 阿里云OSS资源更新日志集合
     */
	@Override
	public List<OssConfigLog> selectOssConfigLogList(OssConfigLog ossConfigLog)
	{
	    return ossConfigLogMapper.selectOssConfigLogList(ossConfigLog);
	}
	
    /**
     * 新增阿里云OSS资源更新日志
     * 
     * @param ossConfigLog 阿里云OSS资源更新日志信息
     * @return 结果
     */
	@Override
	public int insertOssConfigLog(OssConfigLog ossConfigLog)
	{
		Date currentDate = taskUtilsMapper.getCurrentDate();
		String userName = ShiroUtils.getUser().getLoginName();
		ossConfigLog.setCreateBy(userName);
		ossConfigLog.setCreateTime(currentDate);
		ossConfigLog.setUpdateBy(userName);
		ossConfigLog.setUpdateTime(currentDate);
	    return ossConfigLogMapper.insertOssConfigLog(ossConfigLog);
	}
	
	/**
     * 修改阿里云OSS资源更新日志
     * 
     * @param ossConfigLog 阿里云OSS资源更新日志信息
     * @return 结果
     */
	@Override
	public int updateOssConfigLog(OssConfigLog ossConfigLog)
	{
//	    return ossConfigLogMapper.updateOssConfigLog(ossConfigLog);
        return 0;
	}

	/**
     * 删除阿里云OSS资源更新日志对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	@Override
	public int deleteOssConfigLogByIds(String ids)
	{
		return ossConfigLogMapper.deleteOssConfigLogByIds(Convert.toStrArray(ids));
	}
	
}
